<php>
	$this->display(tpl('head',true)); 
</php>
<style>
	.layui-form-select{
		width: 30%;
	}
</style>
<script src="/Public/global/js/colpick.js" type="text/javascript" charset="utf-8"></script>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
  <legend>{{$data['name']}}设置</legend>
</fieldset>
<div class="layui-item">
	<a href="{{admin_plugin_url }}index/vendor/dir_yunpian/c_index/m_add" class="layui-btn layui-btn-primary">添加模板</a>
</div>
<form class="layui-form" method="post" action="">
	<div class="layui-tab">
		<div class="layui-tab-content">
			<div class="layui-tab-item layui-show">
				<table class="layui-table my-tabel">
					<tbody>
						
						<tr>
							<td>APIKEY</td>
							<td>
								<input name="setting[apikey]" value="{{$setting['apikey'] }}" class="layui-input my-input" type="text">
							</td>
						</tr>
						<foreach array="code" value="value">
							<tr>
								<td>{{$value }}模板ID</td>
								<td>
									<input name="setting[code][{{$key }}]" value="{{$setting['code'][$key] }}" class="layui-input my-input" type="number">
								</td>
							</tr>
						</foreach>
						<tr>
							<td colspan="2" align="center">
								<input type="hidden" name="id" value="{{$_GET['id'] }}" />
								<input type="hidden" name="step" value="post" />
								<button class="layui-btn" lay-submit="" lay-filter="post">立即提交</button>
							</td>
						</tr>
					</tbody>
				</table>
			</div>
		</div>
  	</div>
</div>
</form>
<script>
	layui.config({
		version: '{{NOWTIME }}'
	});
	layui.use(['upload','form','layer','element','laydate'], function(){
	  	var $ = layui.jquery
	  	,element = layui.element
	  	,upload = layui.upload;
	   	var $ = layui.jquery, layer = layui.layer;
		var form = layui.form;
		//选完文件后不自动上传
		upload.render({
		    elem: '#select_pic',
		    url: '/admin/upfile/up/thumb_1/json_true/',
		    auto: true,
		    bindAction: '#star_upload',
		    before: function(obj){
		    	files = obj.pushFile(); //将每次选择的文件追加到文件队列
		    	loading = layer.load();
		    },
		    done: function(res, index, upload){
		    	layer.close(loading);
			    if(res.Result==0){
			    	layer.msg(res.content);
			    }else{
			      	$('#thumb').val(res.url); 
			    }
			    delete files[index]; //删除对应的文件
		    }
		});
	});	  
</script>

<php> $this->display(tpl('foot',true)); </php>
